package com.FindMyStuff.Activities;

import com.FindMyStuff.Model.SessionManager;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;

public class AdminHomeActivity extends Activity {
	
	/**
	 * Holds the SessionManager so garbage collection will not get rid of the session manager
	 */
	private SessionManager sm;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_admin_home);
		sm = SessionManager.getInstance();
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_admin_home, menu);
		return true;
	}
	
	/**
	 * Sends the user to the AdminUnlockActivity page
	 * @param view
	 */
	public void goToUnlock(View view){
		Intent intent = new Intent(this, AdminUnlockActivity.class);
		startActivity(intent);
	}
	
	/**
	 * Sends the user to the CreateAdminActivity page
	 * @param view
	 */
	public void goToNewAdmin(View view){
		Intent intent = new Intent(this, CreateAdminActivity.class);
		startActivity(intent);
	}
	
	/**
	 * Logs the user out of the application
	 * @param view
	 */
	public void logout(View view){
		Intent intent = new Intent(this, LogInActivity.class);
		sm.logout();
		startActivity(intent);
	}

}
